package cn.vconinfo.base.observe;

import org.springframework.boot.CommandLineRunner;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ObserverConfiguration {

    @Bean
    public CommandLineRunner commandLineRunner(ApplicationContext context){
        return (args -> {
           context.publishEvent(new ObserverEvent("观察者模式"));
        });
    }

    @Bean
    public ObserverListener readerListener1(){
        return new ObserverListener("spring观察者模式");
    }

}
